package com.caption.inter.controller;

import com.caption.inter.entity.InterRequest;
import com.caption.inter.service.factory.PingAnBankHandlerFactory;
import com.caption.inter.service.handler.Handler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/common")
public class CommonController {

    @RequestMapping("/inter")
    public void inter(InterRequest request) {
        Handler handler = null;
        if (request.getBankCode().equals("PingAn")) {
            PingAnBankHandlerFactory factory = new PingAnBankHandlerFactory();
            handler = factory.create();
        }
        handler.handle(request);
    }
}
